package com.bibrApp.difu.actvity.chengjiao_mvp;

import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.bibrApp.difu.R;
import com.bibrApp.difu.actvity.record_mvp.RecordBean;
import com.bibrApp.difu.utils.Tools;
import com.bibrApp.difu.utils.UIUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

/**
 * @CreateDate 2020/3/9
 * @Author dj
 */
public class ChengjiaoAdapter extends BaseQuickAdapter<ChengjiaoBean, BaseViewHolder> {


    public ChengjiaoAdapter() {
        super(R.layout.item_chengjiao);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, ChengjiaoBean item) {
        TextView tvName = helper.getView(R.id.tv_name);
        if (item.getPawnCoinEunit().equals("BTC")) {
            UIUtils.setDrawableLeft(tvName, R.mipmap.img_btc_28);
        } else if (item.getPawnCoinEunit().equals("ETH")) {
            UIUtils.setDrawableLeft(tvName, R.mipmap.img_eth_28);
        } else {
            UIUtils.setDrawableLeft(tvName, R.mipmap.img_usdt_28);
        }
        tvName.setText(item.getPawnCoinEunit());

        helper.setText(R.id.tv_drate, item.getLegalDailyRate() + "%");
        helper.setText(R.id.tv_money, item.getLegalQuantity());
        helper.setText(R.id.tv_cycle, item.getCycle() + "天");
        helper.setText(R.id.tv_sxf, item.getFee());
        helper.setText(R.id.tv_diya, item.getLockMoney());
        helper.setText(R.id.tv_dyrate, item.getPawnRate() + "%");
        helper.setText(R.id.tv_time, Tools.getTime(item.getCreateTime()));
        helper.setText(R.id.tv_type, "0".equals(item.getType()) ? "借入" : "借出");
    }


}